<?php
/*
* Copyright (c) 2010 by Cediti
*
* You may distribute under the terms of either the GNU Lesser General
* Public License or the new BSD License, as specified in the README file.
*/
// created :	01 March 2010
// version :	31/03/2010

class Cmis_Clients
{
    /**
     * Create a cmis client 
     * @param string $type vendor name
     * @param string $login
     * @param string $password
     * @param string $endpoint
     * @param const $auth_type
     * @param bool $use_ssl
     * @return Cmis_Vendor_Client_Interface
     */
    public static function factory($type, $login, $password, $endpoint, $protocol, array $protocol_config = null, $auth_type = Cmis_Request_Interface::AUTH_HTTP_BASIC, $use_ssl = false)
    {
    	if (is_numeric($type))
    	{
    		$type = 'Generic';
    	}

        $client = 'Cmis_Vendor_Client_' . ucfirst($type);

        if (!class_exists($client, true))
        {
            $client = 'Cmis_Vendor_Client_Generic';
        }

        return new $client($login, $password, $endpoint, $protocol, $protocol_config, $auth_type, $use_ssl, $type);
    }

    /**
     * Get the list of repository vendor name
     * 
     * This is hard coded list ...
     * 
     * @return array
     */
    public static function getListRepositoryType()
    {
        return array('Generic'=>'Generic (no vendor specific)', 'Alfresco' => 'Alfresco');
    }
}

# EOF
